/**
 * 
 */
package neptune.web.client.controller;

import neptune.web.client.services.SecurityException;
import neptune.web.client.view.ConsoleManager;
import neptune.web.client.view.components.dialogs.LogInDialog;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * @author Roberto Bifulco [info@robertobifulco.it, robertobifulco.it]
 * 
 */
public class TopologyConfigurationController implements AsyncCallback<Boolean> {

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.gwt.user.client.rpc.AsyncCallback#onFailure(java.lang.Throwable)
	 */
	public void onFailure(Throwable caught) {
		ConsoleManager.addConsoleMessage("Error while configuring topology: "
				+ caught.getMessage(), true);
		
		if(caught instanceof SecurityException){
			LogInDialog dialog = new LogInDialog();
			dialog.setListener(new LogInDialogController());
			dialog.show();
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.gwt.user.client.rpc.AsyncCallback#onSuccess(java.lang.Object)
	 */
	public void onSuccess(Boolean result) {
		ConsoleManager.addConsoleMessage("Topology configured", false);
	}

}
